package com.example.myapplication;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.myapplication.utils.DateUtil;

public class ButtonLongClick extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_button_long_click);

        TextView text = findViewById(R.id.text);
        Button btn = findViewById(R.id.btn);
        btn.setOnLongClickListener(view -> {
            text.setText("长按"+ DateUtil.getNowTime());
            return true;
        });
    }
}